import { Component, OnInit } from '@angular/core';
import { IDemoDetailConfig } from "p-wit-demo";

@Component({
  selector: 'app-app-context-broker-detail',
  templateUrl: './app-context-broker-detail.component.html',
  styleUrls: ['./app-context-broker-detail.component.scss']
})
export class AppContextBrokerDetailComponent implements OnInit {
  detailCrudConfig: IDemoDetailConfig;
  contextCounts: number[];

  constructor() {
    this.contextCounts = [1];
  }

  ngOnInit() {
    let config = {
      title: 'Context Broker Component',
      templateHtml: getPropertiestemplate(),
      sampleCodes: getSampleCodes()
    };
    this.detailCrudConfig = config;
    this.detailCrudConfig.contentStyle = {
      'overflow': 'hidden',
    };
    this.detailCrudConfig.templateStyle = {
      'height': '300px',
    };
  }


  addNewContextForm(event: any) {
    this.contextCounts.push(1);
  }
}


function getPropertiestemplate(): string {
  return require('../../../assets/properties-template.html');
}

function getSampleCodes(): any[] {
  return [{
    fileName: 'app-context-broker-basic.component.html',
    codeType: 'Html',
    code: require('../basic/app-context-broker-basic.component.html')
  }, {
    fileName: 'app-context-broker-basic.component.ts',
    codeType: 'JavaScript',
    code: require('!raw-loader!../basic/app-context-broker-basic.component.ts')
  }, {
    fileName: 'app-context-broker-basic.component.scss',
    codeType: 'css',
    code: require('!raw-loader!../basic/app-context-broker-basic.component.scss')
  }, {
    fileName: 'util.ts',
    codeType: 'JavaScript',
    code: require('!raw-loader!../../utils/sample.context.ts')
  },];
}
